<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="${ctx }/css/admin/admin.css" type="text/css" rel="stylesheet"/>
<title>block management</title>
</head>
<body>
<form:form action="${ctx }/admin/block/new" method="post">
<table class="usertableborder" cellspacing="1" cellpadding="3" width="96%" align="center" border="0">
	<tr>
		<th colspan="6">创建</th>
	</tr>
	<tr>
		<td class="usertablerow2">
			<c:choose>
				<c:when test="${param.type=='hotItem' }">热门商品
					<input type="hidden" name="type" value="${param.type }"/>
				</c:when>
				<c:when test="${param.type=='hotShop' }">热门店铺
					<input type="hidden" name="type" value="${param.type }"/>
				</c:when>
			</c:choose>
			<form:errors path="type"/>
		</td>
		<td class="usertablerow2">
			<c:choose>
				<c:when test="${param.type=='hotItem' }">商品ID</c:when>
				<c:when test="${param.type=='hotShop' }">商家名称</c:when>
			</c:choose>
		</td>
		<td class="usertablerow2"><input type="text" name="value" value=""/><form:errors path="value"/></td>
		<td class="usertablerow2">排序</td>
		<td class="usertablerow2"><input type="text" name="order" value=""/><form:errors path="order"/></td>
		<td class="usertablerow2"><button type="submit" value="submit">提	交</button></td>
	</tr>
</table>
</form:form>

<br/>

<table class="usertableborder" cellspacing="1" cellpadding="3" width="96%" align="center" border="0">
	<tr>
		<th class="usertablerow2">ID</th>
		<th class="usertablerow2">类型</th>
		<th class="usertablerow2">
			<c:choose>
				<c:when test="${param.type=='hotItem' }">商品ID</c:when>
				<c:when test="${param.type=='hotShop' }">商家名称</c:when>
			</c:choose>
		</th>
		<th class="usertablerow2">排序</th>
		<th class="usertablerow2">修改时间</th>
		<th class="usertablerow2">操作</th>
	</tr>
	<c:forEach items="${result }" var="block">
	<tr>
	<form action="${ctx }/admin/block/edit" method="post">
	<input type="hidden" name="id" value="${block.id }">
	<input type="hidden" name="type" value="${block.blockDesc.type }">
		<td class="usertablerow2">${block.id }</td>
		<td class="usertablerow2">
			<c:choose>
				<c:when test="${block.blockDesc.type=='hotItem' }">热门商品</c:when>
				<c:when test="${block.blockDesc.type=='hotShop' }">热门店铺</c:when>
			</c:choose>
		</td>
		<td class="usertablerow2"><input type="text" name="value" value="${block.blockDesc.value }"></td>
		<td class="usertablerow2"><input type="text" name="order" value="${block.blockDesc.order }"></td>
		<td class="usertablerow2"><fmt:formatDate value="${block.lastUpdateDate }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
		<td class="usertablerow2"><button type="submit" value="submit">修改</button></td>
	</form>
	</tr>
	</c:forEach>
</table>	
</body>
</html>